#!/usr/bin/env python

import wx
import component
import resource.icon as icon

import __main as main

class Main(component.Frame):
    '''Main object
    
    @author Julot <andy.julot@gmail.com>
    @since Saturday, January 14, 2012. 09:01 AM'''
    
    def __init__(self):
        super(Main, self).__init__(None, name='Main')
        import app
        meta = app.Meta()
        self.Title = '%s Version %s' % (meta.name, meta.long_version)
        self.Icon = icon.Main.Icon
        self._realize()
    
    def _realize(self):
        self.MenuBar = main.MenuBar()
        self.ToolBar = main.ToolBar(self)
        self.ToolBar.Realize()
        self.StatusBar = wx.StatusBar(self)
        
        panel = wx.Panel(self)
        self.data = main.Data(panel)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.data, 1, wx.GROW)
        panel.SetSizer(sizer)
    
    def start(self):
        self.data.DeleteAllItems()
        self.MenuBar.data.start.Enable(False)
        self.MenuBar.data.stop.Enable()
        self.ToolBar.start.disable()
        self.ToolBar.stop.enable()
    
    def stop(self):
        self.MenuBar.data.start.Enable()
        self.MenuBar.data.stop.Enable(False)
        self.ToolBar.start.enable()
        self.ToolBar.stop.disable()
        